import {Action, commit} from '@/store/Utils';
import {deepAssign} from '@/base/util/Objects';

export class InfoState {
  sortId = 0
}

abstract class BaseAction implements Action {
  namespace? = 'info';
}

class SetAction extends BaseAction {
  sortId?: number;

  static typed(state: InfoState, payload: SetAction): void {
    deepAssign(state, payload);
  }
}

export const info = {
  namespaced: true,
  state: new InfoState(),
  getters: {},
  actions: {},
  mutations: {
    [SetAction.name]: SetAction.typed
  }
};

export class infoBloc {
  static getSortId(sortId: number) {
    commit(SetAction, {sortId});
  };
}
